<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="${request.contextPath}/"/>
    <meta charset="UTF-8">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,minimum-scale=1.0">
    <title>发起心愿</title>
    <link href="Content/wechat/css/reset.css" rel="stylesheet" type="text/css">
    <!--签到-->
    <link href="Content/wechat/css/woDeXinYuan_FB.css" rel="stylesheet" type="text/css">

    <script src="Content/wechat/js/jquery.min.js"></script>
    <!--字体缩放-->
    <script src="Content/wechat/js/ziti.js"></script>
    <!--end 字体缩放-->
    <script src="Content/wechat/js/jquery.validate.js"></script>
    <!--上传图片js-->
    <script  src="Content/wechat/js/svg.js"></script>

    <!--<script src="Content/wechat/js/layer.js"></script>-->

</head>
<body>
<header >
    <img src="Content/wechat/images/yw.jpg">
</header>
<div class="xinyuan">
    <form id="form">
    <div class="xinyuan_box">
        <dl class="clearfix">
            <dt>小小心愿</dt>
            <dd>
                <input class="text" type="text" name="wishname" id="wishname" placeholder="请输入愿望标题">
            </dd>
        </dl>
        <dl class="clearfix">
            <dt>求助人</dt>
            <dd>
                <input class="text" type="text" name="people" id="people" placeholder="请输入姓名">
            </dd>
        </dl>
        <dl class="clearfix">
            <dt>联系方式</dt>
            <dd>
                <input class="text" type="text" name="phone" id="phone" placeholder="请输入电话">
                <label hidden="hidden" id="realizename-errorsj" class="error" for="realizenamesj"></label>
            </dd>
        </dl>
        <dl class="clearfix">
            <dt>所在社区</dt>
            <dd>
            <select name="villageid" id="villageid">
                <!--<option value="" selected="selected">-&#45;&#45;请选择-&#45;&#45;</option>-->
                <#list commList as item>
                    <option value="${item.id}" >${item.communityname!}</option>
                </#list>
            </select>
            </dd>
        </dl>
        <h4>详细信息：</h4>
        <textarea class="textarea" name="content" id="content" placeholder="请简要说明"></textarea>
        <!--上传多张图片-->
    </div>
    </form>
    <div class="button_shangChuan" type="button" id="submit">确定</div>
<!--    <button class="button_shangChuan" type="button" id="submit">确定</button>-->
</div>
</body>
<script type="text/javascript">
    $().ready(function () {
        $("#submit").click(function(){
    //        if( $("input[name='wishname']").val() == ""||  $("input[name='wishname']").val().length ==0){
    //            alert("心愿不能为空");
    //            $("input[name='wishname']").focus();
    //            return;
    //        }
            var phone = document.getElementById('phone').value;
            if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone))){
                $("#realizename-errorsj").html("请输入正确的手机号格式");
                return false;
            }
            if ($("#form").valid()) {
                var loadingIndex = null;
                $.ajax({
                    url: "wechat/home/party/wish/saveForm",
                    type: "POST",
                    data: $("#form").serialize(),
                    success: function () {
                        window.location.href = "wechat/home/party/wish/wish_list_flase"
                    }
                })
            }
        })
        $("#form").validate({
            rules: {
                wishname: {
                    required: true,
                    minlength: 2,
                    maxlength: 50,

                },
//                realizephone: {
//                    required: true,
//                    digits: "只能输入数字",
//                    number: "请输入有效的数字",
//                    minlength: 11,
//                    maxlength: 11,
//
//                },
                people: {
                    required: true,
                    minlength: 2,
                    maxlength: 13,

                },

                content: {
                    required: true,
                    minlength: 5,
                    maxlength: 500,

                }
            },
            messages: {
                wishname: {
                    minlength: "(字符不能少于 2 个且不能大于 50个)",
                    maxlength: "(字符不能少于 2 个且不能大于 50个)",
                },
                people: {
                    minlength: "(字符不能少于 2 个且不能大于 13个)",
                    maxlength: "(字符不能少于 2 个且不能大于 13个)",
                },
                content: {
                    minlength: "(字符不能少于 5 个且不能大于 500个)",
                    maxlength: "(字符不能少于 5 个且不能大于 500个)",
                }
            }


        })
    });
</script>
</html>
